#include "tcpsocket.h"
#include <unistd.h>

// tcp服务端实现

int main(int argc, char const *argv[])
{
    int sfd = create_tcp_server_socket(argv[1], atoi(argv[2]));
    if (sfd == -1) {
        exit(EXIT_FAILURE);
    }

    //客户端连接
    struct sockaddr_in cli_addr;
    bzero(&cli_addr, sizeof(cli_addr));
    int cfd = wait_for_connect(sfd, &cli_addr);
    if(cfd == -1) {
        exit(EXIT_FAILURE);
    }
    show_tcp_network_address(&cli_addr);
    close(cfd);
    close(sfd);
    return 0;
}
